<%@ page import="com.arvinclub.model.entity.Blog" %><%--
  Created by IntelliJ IDEA.
  User: arvin
  Date: 2019/7/12
  Time: 3:47 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="base.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <link href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900" rel="stylesheet" type="text/css"/>
    <title>搜索-ArvinClub</title>
    <!-- Bootstrap core CSS -->
    <link rel="icon" type="images/x-icon" href="${ctx}file/images/favicon.ico">
    <link href="${ctx}vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <!-- Additional CSS Files -->
    <link rel="stylesheet" href="${ctx}assets/css/fontawesome.css" type="text/css"/>
    <link rel="stylesheet" href="${ctx}assets/css/templatemo-style.css" type="text/css"/>
    <link rel="stylesheet" href="${ctx}assets/css/owl.css" type="text/css"/>
    <link rel="stylesheet" href="${ctx}assets/css/lightbox.css" type="text/css"/>
    <style>
        .myclass:hover {
            color: #4f9bff;
        }

        .myclass {
            display: inline-block;
            color: #a43f49;
        }

        .myb1 {
            margin: 30px 0 0 15px;
        }

        .myb2 {
            margin: 30px 15px 0 0;
        }

        @media (max-width: 845px) {
            .section-heading {
                padding: 40px 0 60px 0;
            }

            section.contact-me {
                padding-bottom: 60px;
            }

            .myimg {
                margin: 0 auto;
                text-align: center;
            }

            .myb1 {
                margin: 30px 0 0 0;
            }

            .myb2 {
                margin: 30px 0 0 0;
            }
        }
    </style>
    <script>
        console.log("感谢您帮我测试,如果发现BUG还请留言。")
    </script>
</head>

<body>
<div id="page-wraper" style="min-height: 100vh">
    <!-- Sidebar Menu -->
    <div class="responsive-nav">
        <i class="fa fa-bars" id="menu-toggle"></i>
        <div id="menu" class="menu">
            <i class="fa fa-times" id="menu-close"></i>
            <div class="container">

                <div class="author-content" style="margin: 80px 0 60px 0">
                    <h4 style="font-size: 40px">${user.name}</h4>
                    <c:choose>
                        <c:when test="${user.admin > 0}">
                            <p style="margin-top: 10px;cursor:pointer" onclick="javascript:window.open('${ctx}admin/manager.html')">管理员</p>
                        </c:when>
                        <c:otherwise>
                            <p style="margin-top: 10px">欢迎</p>
                        </c:otherwise>
                    </c:choose>                </div>
                <nav class="main-nav" role="navigation">
                    <ul class="main-menu">
                        <li><a href="${ctx}user/blogs.html">网站首页</a></li>
                        <li><a href="${ctx}user/attention.html">关注动态</a></li>
                        <li><a href="${ctx}user/page.html">我的主页</a></li>
                        <li><a href="${ctx}user/chat.html">在线聊天</a></li>
                        <li><a href="${ctx}user/search.html" style="background: #fff;color: #8c363e">查找内容</a></li>
                        <li><a href="${ctx}user/update.html">更新日志</a></li>
                        <li><a href="${ctx}user/exit">退出登录</a></li>
                    </ul>
                </nav>
                <div class="social-network">

                </div>
                <div class="copyright-text">
                    <p>Copyright &copy; 2019 Arvin<br>联系方式: <a href="mailto:arvin5445@qq.com" target="_top">arvin5445@qq.com</a><br><a
                            href="http://beian.miit.gov.cn/" target="_blank">浙ICP备19031638号-1</a></p>
                </div>
            </div>
        </div>
    </div>
    <section class="section contact-me" data-section="section4">
        <div class="container" style="max-width: unset;">
            <div class="section-heading">
                <h1 style="word-break: break-word">查找内容</h1>
                <div class="line-dec"></div>
                <span
                >输入关键字搜索内容或用户</span
                >
            </div>
            <div class="row">
                <div class="right-content" style="margin: 0 auto;width: 100%">
                    <div class="container" style="max-width: unset">
                        <form id="contact" action="/user/search.html" method="post">
                            <div class="row">
                                <div class="col-md-12">
                                    <fieldset>
                                        <textarea name="keyword" rows="6" class="form-control" id="message"
                                                  placeholder="在这里输入关键字..." required=""
                                                  style="font-size: 18px;width: 100%" value="www"
                                        ></textarea>
                                    </fieldset>
                                </div>
                                <div class="col-md-12">
                                    <fieldset>
                                        <button type="submit" id="form-submit" class="button" style="font-size: 16px">
                                            搜索
                                        </button>
                                    </fieldset>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="section about-me" data-section="section1" style="border-bottom: none">
        <div class="container" style="max-width: unset">
            <c:if test="${! empty blogPage.list}">
                <c:forEach var="blog" items="${blogPage.list}">
                    <div class="right-image-post"
                         onclick="javascript:window.location.href='${ctx}user/detail.html/${blog.id}'">
                        <div class="row">
                            <div class="col-md-6" style="flex: unset;
                max-width: unset;">
                                <div class="left-text">
                                    <a style="word-break: break-word"
                                       href="${ctx}user/<c:choose><c:when test="${blog.user.id == 4}">update.html</c:when><c:otherwise>page.html/${blog.user.id}</c:otherwise></c:choose>">

                                        <h4 class="myclass">@<c:out value="${blog.user.name}"/></h4></a>
                                    <%
                                        String[] strings = ((Blog) pageContext.getAttribute("blog")).getContent().split("\n");
                                        pageContext.setAttribute("strings", strings);
                                    %>
                                    <div style="word-break: break-word;font-size: 18px;padding: 30px 15px 0 15px">
                                        <c:forEach items="${strings}" var="str">
                                            <c:out value="${str}"/><br>
                                        </c:forEach><br>
                                        <c:if test="${! empty blog.filenameList}">
                                            <div class="myimg">
                                                <c:forEach items="${blog.filenameList}" var="filename">
                                                    <a href="${ctx}file/images/${filename}" target="_blank">
                                                        <div style="background: url(${ctx}file/images/${filename}) no-repeat center center ;width: 200px;height: 200px;background-size: cover;display:inline-block;margin:15px 30px 15px 0"></div>
                                                    </a>
                                                </c:forEach><br></div>
                                        </c:if>
                                        <br>
                                    </div>
                                    <span style="color: #666">---<c:out value="${blog.time}"/></span>
                                    <span style="display: inline-block;color: #666;float: right">
                                        <a href="${ctx}user/detail.html/${blog.id}"
                                           style="color: #666;">
                                            <c:choose>
                                                <c:when test="${blog.commentCount gt 0}">
                                                    共 ${blog.commentCount} 条评论
                                                </c:when>
                                                <c:otherwise>
                                                    暂无评论
                                                </c:otherwise>
                                            </c:choose>
                                        </a>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                </c:forEach>
            </c:if>

            <div style="margin: 0 auto;text-align: center">
                <c:choose>
                    <c:when test="${blogPage.list == null || fn:length(blogPage.list) == 0}"><span
                            style="margin-top: 35px;display: inline-block;color: #666">没有任何内容</span></c:when>
                    <c:otherwise><a href="${ctx}user/search.html/${blogPage.prePage}"
                                    <c:if test="${blogPage.isFirstPage}">style="visibility: hidden" </c:if>>
                        <button style="float: left" class="myb1">上一页</button>
                    </a>


                        <span style="margin-top: 35px;display: inline-block;color: #666"><a
                                href="${ctx}user/search.html/${blogPage.pageNum}"
                                style="color: #666;">第 ${blogPage.pageNum} 页</a> / <a
                                href="${ctx}user/search.html/${blogPage.pages}"
                                style="color: #666;">共 ${blogPage.pages} 页</a></span>

                        <a href="${ctx}user/search.html/${blogPage.nextPage}"
                           <c:if test="${blogPage.isLastPage}">style="visibility: hidden" </c:if>>
                            <button style="float: right" class="myb2">下一页</button>
                        </a></c:otherwise>
                </c:choose>

            </div>

        </div>
    </section>


</div>
<c:if test="${! empty sessionScope.keyword}">
    <script>
        document.getElementById("message").innerHTML = "${sessionScope.keyword}";
    </script>
</c:if>
<!-- Scripts -->
<!-- Bootstrap core JavaScript -->
<script src="${ctx}vendor/jquery/jquery.min.js" type="text/javascript"></script>
<script src="${ctx}vendor/bootstrap/js/bootstrap.bundle.min.js" type="text/javascript"></script>
<script src="${ctx}assets/js/isotope.min.js" type="text/javascript"></script>
<script src="${ctx}assets/js/owl-carousel.js" type="text/javascript"></script>
<script src="${ctx}assets/js/lightbox.js" type="text/javascript"></script>
<script src="${ctx}assets/js/custom.js" type="text/javascript"></script>

</body>
</html>


